package com.pvj.myaccount.room.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import java.io.Serializable

@Entity
data class MonthCost(
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    var id: Int,
    @ColumnInfo(name = "name") var name: String,
    @ColumnInfo(name = "money", typeAffinity = ColumnInfo.REAL) var money: Double,
    @ColumnInfo(name = "type") var type: String
)  : Serializable {
    /***
     * 由于 Room 只能识别和使用一个构造器,如果想使用多个构造器,使用 @Ignore 标签,忽略构造器
     *
     */
    @Ignore
    constructor(name: String, money: Double, type: String) : this(0, name, money, type) {
        this.name = name
        this.money = money
        this.type = type
    }
}